package com.bml.architect.sentinel.handler;

import com.alibaba.cloud.commons.lang.StringUtils;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

@Component
public class MyRequestOriginParser implements RequestOriginParser {


    @Override
    public String parseOrigin(HttpServletRequest request) {

        String serviceName = request.getParameter("serviceName");
        if (StringUtils.isNotBlank(serviceName))
            return serviceName;

        return null;
    }
}
